package com.onpositive.simple.persistance;

public class StringIndex extends TreeSearchIndex<String> {
	
	protected IStringStorage stringStorage ;

	public StringIndex( IStringStorage _storage, int m, AbstractNodeStorage storage ) {
		super( String.class, m, storage );
		stringStorage = _storage ;
	}

	@Override
	protected boolean isLess(int arg1, int arg2) {
		String s1 = stringStorage.get(arg1) ;
		String s2 = stringStorage.get(arg2) ;
		return s1.compareTo(s2) < 0 ;
	}
	@Override
	protected boolean isLessEqual(int arg1, int arg2) {
		String s1 = stringStorage.get(arg1) ;
		String s2 = stringStorage.get(arg2) ;
		return s1.compareTo(s2) <= 0 ;
	}
	@Override
	protected boolean isGreater(int arg1, int arg2) {
		String s1 = stringStorage.get(arg1) ;
		String s2 = stringStorage.get(arg2) ;
		return s1.compareTo(s2) > 0 ;
	}

	@Override
	protected boolean isGreaterEqual(int arg1, int arg2) {
		String s1 = stringStorage.get(arg1) ;
		String s2 = stringStorage.get(arg2) ;
		return s1.compareTo(s2) >= 0 ;
	}

	@Override
	protected boolean isEqual(int arg1, int arg2) {
		String s1 = stringStorage.get(arg1) ;
		String s2 = stringStorage.get(arg2) ;
		return s1.compareTo(s2) == 0 ;
	}

	@Override
	protected boolean isEqual_k(String key, int arg) {
		String s = stringStorage.get(arg) ;
		return key.compareTo(s) == 0 ;
	}

	@Override
	protected boolean isLess_k(String key, int arg) {
		String s = stringStorage.get(arg) ;
		return key.compareTo(s) < 0 ;
	}

	@Override
	protected boolean isLessEqual_k(String key, int arg) {
		String s = stringStorage.get(arg) ;
		return key.compareTo(s) <= 0 ;
	}

	
	@Override
	protected boolean isLess_k(int arg, String key) {
		String s = stringStorage.get(arg) ;
		return s.compareTo(key) < 0 ;
	}

	@Override
	protected boolean isLessEqual_k(int arg, String key) {
		String s = stringStorage.get(arg) ;
		return s.compareTo(key) <= 0 ;
	}

	@Override
	protected boolean isGreater_k(String key, int arg) {
		String s = stringStorage.get(arg) ;
		return key.compareTo(s) > 0 ;
	}

	@Override
	protected boolean isGreaterEqual_k(String key, int arg) {
		String s = stringStorage.get(arg) ;
		return key.compareTo(s) >= 0 ;
	}

	
	@Override
	protected boolean isGreater_k(int arg, String key) {
		String s = stringStorage.get(arg) ;
		return s.compareTo(key) > 0 ;
	}

	@Override
	protected boolean isGreaterEqual_k(int arg, String key) {
		String s = stringStorage.get(arg) ;
		return s.compareTo(key) >= 0 ;
	}

	@Override
	protected boolean isLess_kk(String key1, String key2) {
		return key1.compareTo(key2) < 0 ; 
	}

	@Override
	protected boolean isEqual_kk(String key1, String key2) {
		return key1.compareTo(key2) == 0 ;
	}

}
